import java.util.Scanner;

public class Demo2 {

    private volatile static int falg=0;
    public static void main(String[] args) {

        Thread t1=new Thread(()->{
            while (falg==0){

            }
            System.out.println("t1 线程结束");
        });

        Thread t2=new Thread(()->{
            Scanner scanner=new Scanner(System.in);
            System.out.println("请输入falg的值");
            int num=scanner.nextInt();
            falg=num;

        });
        t1.start();
        t2.start();
    }
}
